package cn.ywang.pattern.delegate;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 经理类
 *
 * @author BeatificWang
 * @date 2019/3/14 21:03
 */
public class Manager {

	private static final Map<String, IEmployee> map = new LinkedHashMap<>(2);

	static {
		map.put("需求", new EmployeeA());
		map.put("开发", new EmployeeB());
	}

	public void command(String command) {
		System.out.println("经理，开始分配任务：" + command);
		IEmployee employee = map.get(command);
		if (employee != null) {
			employee.doWork(command);
		}
		else {
			System.out.println("警告：没有能干活的员工");
		}
	}
}
